function setCaretPosition (textDom, pos) {
    if (textDom.setSelectionRange) {
        textDom.focus();
        textDom.setSelectionRange(pos, pos);
    } else if (textDom.createTextRange) {
        var range = textDom.createTextRange();
        range.collapse(true);
        range.moveEnd('character', pos);
        range.moveStart('character', pos);
        range.select();
    }
}

export default {
    resolveParams (url) {
        url = url || '';

        let dict = new Map();

        if (url.indexOf('?') == -1) {
            return dict;
        }

        let queryString = url.substr(url.indexOf('?'));
        let params = queryString.split('&');

        for (let p of params) {
            let segment = p.split('=');

            dict.set(decodeURIComponent(segment[0]), decodeURIComponent(segment[1]));
        }

        return dict;
    }
};